package com.wang.study.service.impl;

import com.wang.study.commons.MybatisUtils;
import com.wang.study.mapper.CategoryMapper;
import com.wang.study.model.Category;
import com.wang.study.service.CategoryService;

import java.util.List;

public class CategoryServiceImp implements CategoryService {
    private CategoryMapper categoryMapper;

    public CategoryServiceImp(){
        categoryMapper= MybatisUtils.getMapper(CategoryMapper.class);
    }
    @Override
    public List<Category> findAll() {
        List<Category> categorys = categoryMapper.findAll();
        return categorys;
    }

    @Override
    public Integer updateById(Integer id, String name, Integer status) {
        Integer i = categoryMapper.updateById(id,name,status);
        return i;
    }

    @Override
    public Integer delById(Integer id) {
        Integer i = categoryMapper.delById(id);
        return i;
    }

    @Override
    public Integer addCategory(Integer id,String name, Integer status) {
        Integer i = categoryMapper.addCategory(id,name,status);
        return i;
    }
}
